package com.power.sifa.approve.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.common.domain.YesNo;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
*  送达记录详情实体类
*/

@Entity
@ApiModel(value="送达记录详情")
@Data
@Table(name="Apl_arrive_detail",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
@AllArgsConstructor
//@IdClass(Apl_arrive_detail.Apl_arrive_detailPK.class) 用于复合组件
public class Apl_arrive_detail extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @ApiModelProperty(value = "applyid")
    private String applyid;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createtime;

    @ApiModelProperty(value = "告警时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date warntime;

    @ApiModelProperty(value = "完成时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date finishtime;

    @ApiModelProperty(value = "通知人id")
    private String noticeperid;

    @ApiModelProperty(value = "通知人名称")
    private String noticeper;

    @ApiModelProperty(value = "是否自定义上传文件")
    private Integer customer;

    @ApiModelProperty(value = "操作人员id")
    private String operateid;

    @ApiModelProperty(value = "操作人员名称")
    private String opereatename;

    @ApiModelProperty(value = "是否发送")
    private Integer sendstatus = YesNo.NO;


    @ApiModelProperty(value = "内容")
    private String content;

    @ApiModelProperty(value = "案号")
    private String acceptcode;


    /**
     *  是否自定义上传文件文本
     */
    @Transient
    @FieldEnumText(eum="yesNo", valuefield="customer")
    private String customer_text;

    /**
     *  是否发送文本
     */
    @Transient
    @FieldEnumText(eum="yesNo", valuefield="sendstatus")
    private String sendstatus_text;

    /**
     * 材料文件
     */
    @Transient
    List<Apl_arrive_material> materialList;
    /**
     * 送达人员
     */
    @Transient
    List<Apl_arrive_person> personList;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("applyid", this.getApplyid());
        map.put("createtime", this.getCreatetime());
        map.put("warntime", this.getWarntime());
        map.put("finishtime", this.getFinishtime());
        map.put("noticeperid", this.getNoticeperid());
        map.put("noticeper", this.getNoticeper());
        map.put("customer_text", this.customer_text);
        map.put("customer", this.getCustomer());
        map.put("operateid", this.getOperateid());
        map.put("opereatename", this.getOpereatename());
        map.put("sendstatus_text", this.sendstatus_text);
        map.put("sendstatus", this.getSendstatus());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Apl_arrive_detailPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Apl_arrive_detailPK pk = (Apl_arrive_detailPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}